package org.kabeja.dxf.entity;

import org.kabeja.dxf.DXFConstants;
import org.kabeja.dxf.DXFDimensionStyle;
import org.kabeja.dxf.helpers.Point;

/**
 * @author shutao
 * @since 2022/4/28 17:12
 */
public class DXFDimension extends DXFEntity {
    protected final int TYPE_LINEAR = 0;
    protected final int TYPE_ALIGNMENT = 1;
    protected final int TYPE_4POINT = 2;
    protected final int TYPE_DIAMETER = 3;
    protected final int TYPE_RADIAL = 4;
    protected final int TYPE_3POINT_ANGLE = 5;
    protected final int TYPE_COORDINATES = 6;
    protected int dimType;
    protected Point referencePoint = new Point();
    protected Point textPoint = new Point();
    protected Point insertPoint = new Point();
    protected Point referencePoint3 = new Point();
    protected Point referencePoint4 = new Point();
    protected Point referencePoint5 = new Point();
    protected Point referencePoint6 = new Point();
    protected int attechmentLocation;
    protected boolean exactTextLineSpacing = false;
    protected double rotate = 0.0D;
    protected double horizontalDirection = 0.0D;
    protected String dimensionStyle = "";
    protected String dimensionText = "";
    protected String dimensionBlock = "";
    protected int dimensionArea = 0;
    protected double textRotation = 0.0D;
    protected double dimensionRotation = 0.0D;
    protected double inclinationHelpLine = 0.0D;
    protected double leadingLineLength = 0.0D;
    protected double horizontalAlign = 0.0D;

    public DXFDimension() {
        this.setLineType(this.getType());
    }

    public int getAttechmentLocation() {
        return this.attechmentLocation;
    }

    public void setAttechmentLocation(int var1) {
        this.attechmentLocation = var1;
    }

    public String getDimensionStyleID() {
        return this.dimensionStyle;
    }

    public void setDimensionStyleID(String var1) {
        this.dimensionStyle = var1;
    }

    public boolean isExactTextLineSpacing() {
        return this.exactTextLineSpacing;
    }

    public void setExactTextLineSpacing(boolean var1) {
        this.exactTextLineSpacing = var1;
    }

    public double getHorizontalDirection() {
        return this.horizontalDirection;
    }

    public void setHorizontalDirection(double var1) {
        this.horizontalDirection = var1;
    }

    public Point getInsertPoint() {
        return this.insertPoint;
    }

    public void setInsertPoint(Point var1) {
        this.insertPoint = var1;
    }

    public Point getReferencePoint() {
        return this.referencePoint;
    }

    public void setReferencePoint(Point var1) {
        this.referencePoint = var1;
    }

    public Point getReferencePoint3() {
        return this.referencePoint3;
    }

    public void setReferencePoint3(Point var1) {
        this.referencePoint3 = var1;
    }

    public Point getReferencePoint4() {
        return this.referencePoint4;
    }

    public void setReferencePoint4(Point var1) {
        this.referencePoint4 = var1;
    }

    public Point getReferencePoint5() {
        return this.referencePoint5;
    }

    public void setReferencePoint5(Point var1) {
        this.referencePoint5 = var1;
    }

    public Point getReferencePoint6() {
        return this.referencePoint6;
    }

    public void setReferencePoint6(Point var1) {
        this.referencePoint6 = var1;
    }

    public double getRotate() {
        return this.rotate;
    }

    public void setRotate(double var1) {
        this.rotate = var1;
    }

    public Point getTextPoint() {
        return this.textPoint;
    }

    public void setTextPoint(Point var1) {
        this.textPoint = var1;
    }

    public int getDimensionType() {
        return this.dimType;
    }

    public void setDimensionType(int var1) {
        this.dimType = var1;
    }

    public double getDimensionRotation() {
        return this.dimensionRotation;
    }

    public void setDimensionRotation(double var1) {
        this.dimensionRotation = var1;
    }

    public String getDimensionText() {
        return this.dimensionText;
    }

    public void setDimensionText(String var1) {
        this.dimensionText = var1;
    }

    public double getHorizontalAlign() {
        return this.horizontalAlign;
    }

    public void setHorizontalAlign(double var1) {
        this.horizontalAlign = var1;
    }

    public double getInclinationHelpLine() {
        return this.inclinationHelpLine;
    }

    public void setInclinationHelpLine(double var1) {
        this.inclinationHelpLine = var1;
    }

    public double getLeadingLineLength() {
        return this.leadingLineLength;
    }

    public void setLeadingLineLength(double var1) {
        this.leadingLineLength = var1;
    }

    public double getTextRotation() {
        return this.textRotation;
    }

    public void setTextRotation(double var1) {
        this.textRotation = var1;
    }

    public String getDimensionBlock() {
        return this.dimensionBlock;
    }

    public void setDimensionBlock(String var1) {
        this.dimensionBlock = var1;
    }

    public int getDimensionArea() {
        return this.dimensionArea;
    }

    public void setDimensionArea(int var1) {
        this.dimensionArea = var1;
    }

    @Override
    public Bounds getBounds() {
        Bounds var1 = new Bounds();
        if (this.doc.getDXFBlock(this.dimensionBlock) != null) {
            DXFBlock var2 = this.doc.getDXFBlock(this.getDimensionBlock());
            Bounds var3 = var2.getBounds();
            Point var4 = var2.getReferencePoint();
            if (var3.isValid()) {
                var1.setMaximumX(var3.getMaximumX() - var4.getX());
                var1.setMinimumX(var3.getMinimumX() - var4.getX());
                var1.setMaximumY(var3.getMaximumY() - var4.getY());
                var1.setMinimumY(var3.getMinimumY() - var4.getY());
                var1.setMaximumX(var1.getMaximumX() + this.insertPoint.getX());
                var1.setMinimumX(var1.getMinimumX() + this.insertPoint.getX());
                var1.setMaximumY(var1.getMaximumY() + this.insertPoint.getY());
                var1.setMinimumY(var1.getMinimumY() + this.insertPoint.getY());
            }
        } else {
            var1.setValid(false);
        }

        return var1;
    }

    public DXFDimensionStyle getDXFDimensionStyle() {
        return this.doc.getDXFDimensionStyle(this.getDimensionStyleID());
    }

    @Override
    public String getType() {
        return DXFConstants.ENTITY_TYPE_DIMENSION;
    }

    @Override
    public double getLength() {
        return 0.0D;
    }
}
